From e525e13e73e0895d1e59872a00f4154e19530721 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 21 Mar 2016 17:19:42 +0300 Subject: [PATCH] word wrapping for EditBox - starting implementation, issue #206 --- src/dlangui/core/editable.d | 7 +++++++ src/dlangui/widgets/editors.d | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/dlangui/core/editable.d b/src/dlangui/core/editable.d index bc028fb8..5a88cfe0 100644 --- a/src/dlangui/core/editable.d +++ b/src/dlangui/core/editable.d @@ -441,6 +441,13 @@ alias TokenProp = ubyte; /// TokenCategory string alias TokenPropString = TokenProp[]; +struct LineSpan { + /// start index of line + int start; + /// number of lines it spans + int len; +} + /// interface for custom syntax highlight, comments toggling, smart indents, and other language dependent features for source code editors interface SyntaxSupport { diff --git a/src/dlangui/widgets/editors.d b/src/dlangui/widgets/editors.d index 086d699a..53512829 100644 --- a/src/dlangui/widgets/editors.d +++ b/src/dlangui/widgets/editors.d @@ -285,6 +285,25 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction return 1; } + protected bool _wordWrap; + /// true if word wrap mode is set + @property bool wordWrap() { + return _wordWrap; + } + /// true if word wrap mode is set + @property EditWidgetBase wordWrap(bool v) { + _wordWrap = v; + invalidate(); + return this; + } + + void wrapLine(dstring line, int maxWidth) { + + } + + /// information about line span into several lines - in word wrap mode + protected LineSpan[] _span; + /// override to add custom items on left panel protected void updateLeftPaneWidth() { _iconsWidth = _showIcons ? _iconsPaneWidth : 0;