diff options
| -rw-r--r-- | include/Scintilla.h | 1 | ||||
| -rw-r--r-- | include/Scintilla.iface | 4 | ||||
| -rw-r--r-- | src/Document.cxx | 14 | ||||
| -rw-r--r-- | src/Document.h | 1 | ||||
| -rw-r--r-- | src/Editor.cxx | 3 | 
5 files changed, 22 insertions, 1 deletions
| diff --git a/include/Scintilla.h b/include/Scintilla.h index 11f9bbd9e..7a6f58fac 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -323,6 +323,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,  #define SCI_GETLINEINDENTATION 2127  #define SCI_GETLINEINDENTPOSITION 2128  #define SCI_GETCOLUMN 2129 +#define SCI_COUNTCHARACTERS 2633  #define SCI_SETHSCROLLBAR 2130  #define SCI_GETHSCROLLBAR 2131  #define SC_IV_NONE 0 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 30aa8caea..99c0d69a1 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -763,9 +763,11 @@ get position GetLineIndentPosition=2128(int line,)  # Retrieve the column number of a position, taking tab width into account.  get int GetColumn=2129(position pos,) +# Count characters between two positions. +get int CountCharacters=2633(int startPos, int endPos) +  # Show or hide the horizontal scroll bar.  set void SetHScrollBar=2130(bool show,) -  # Is the horizontal scroll bar visible?  get bool GetHScrollBar=2131(,) diff --git a/src/Document.cxx b/src/Document.cxx index 86d5c6077..c721c88ff 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -1094,6 +1094,20 @@ int Document::GetColumn(int pos) {  	return column;  } +int Document::CountCharacters(int startPos, int endPos) { +	startPos = MovePositionOutsideChar(startPos, 1, false); +	endPos = MovePositionOutsideChar(endPos, -1, false); +	int count = 0; +	int i = startPos; +	while (i < endPos) { +		count++; +		if (IsCrLf(i)) +			i++; +		i = NextPosition(i, 1); +	} +	return count; +} +  int Document::FindColumn(int line, int column) {  	int position = LineStart(line);  	if ((line >= 0) && (line < LinesTotal())) { diff --git a/src/Document.h b/src/Document.h index bd8a58274..ec41603eb 100644 --- a/src/Document.h +++ b/src/Document.h @@ -303,6 +303,7 @@ public:  	void SetLineIndentation(int line, int indent);  	int GetLineIndentPosition(int line) const;  	int GetColumn(int position); +	int CountCharacters(int startPos, int endPos);  	int FindColumn(int line, int column);  	void Indent(bool forwards, int lineBottom, int lineTop);  	static char *TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolModeWanted); diff --git a/src/Editor.cxx b/src/Editor.cxx index 4c647b61e..8c939fdb1 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -9259,6 +9259,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_GETTECHNOLOGY:  		return technology; +	case SCI_COUNTCHARACTERS: +		return pdoc->CountCharacters(wParam, lParam); +  	default:  		return DefWndProc(iMessage, wParam, lParam);  	} | 
