From ff0018fbc36d8c93814b9cb3d0df53bafd4ef6b6 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 8 Jun 2000 10:13:35 +0000 Subject: Added GetColumn that determines the column of a position. --- src/Document.cxx | 19 +++++++++++++++++++ src/Document.h | 1 + src/Editor.cxx | 5 +++++ 3 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/Document.cxx b/src/Document.cxx index 0f71231b6..c5aad504d 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -600,6 +600,25 @@ int Document::GetLineIndentPosition(int line) { return pos; } +int Document::GetColumn(int pos) { + int column = 0; + int line = LineFromPosition(pos); + if ((line >= 0) && (line < LinesTotal())) { + for (int i=LineStart(line);i= lineTop; line--) { diff --git a/src/Document.h b/src/Document.h index 92e4ff14f..64955639e 100644 --- a/src/Document.h +++ b/src/Document.h @@ -124,6 +124,7 @@ public: int GetLineIndentation(int line); void SetLineIndentation(int line, int indent); int GetLineIndentPosition(int line); + int GetColumn(int position); void Indent(bool forwards, int lineBottom, int lineTop); void ConvertLineEnds(int eolModeSet); void SetReadOnly(bool set) { cb.SetReadOnly(set); } diff --git a/src/Editor.cxx b/src/Editor.cxx index f753e35ce..e13fe1a2e 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2995,6 +2995,7 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { nEnd = pdoc->Length(); if (nStart < 0) nStart = nEnd; // Remove selection + selType = selStream; SetSelection(nEnd, nStart); EnsureCaretVisible(); } @@ -3004,6 +3005,7 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { if (lParam == 0) return 0; CHARRANGE *pCR = reinterpret_cast(lParam); + selType = selStream; if (pCR->cpMax == -1) { SetSelection(pCR->cpMin, pdoc->Length()); } else { @@ -3409,6 +3411,9 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case SCI_GETLINEINDENTPOSITION: return pdoc->GetLineIndentPosition(wParam); + + case SCI_GETCOLUMN: + return pdoc->GetColumn(wParam); case SCI_SETHSCROLLBAR : horizontalScrollBarVisible = wParam; -- cgit v1.2.3