Skip to content

Commit 3892ac4

Browse files
committed
Fixed text delete/cut bugs (BalazsJako#32)
1 parent 67ca3b4 commit 3892ac4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ public API to externally implement these features is however included.
7171
- Has marker API to specify lines and/or line numbers to highlight and optional show tooltips (see [example](docs/markers.md)).
7272
- Has optional scrollbar minimap to render cursor, selection and marker locations.
7373
- Provides middle-mouse pan and scroll functions like CAD programs and browsers.
74-
- Has API to attach user data to select or all lines (see [example](docs/userData.md)).
74+
- Has API to attach user data to select lines or all lines (see [example](docs/userData.md)).
7575
- Has API to decorate each line (useful for debuggers and IDEs) (see [example](docs/lineDecorator.md)).
76-
- Provides optional and customizable right click context menus for line numbers or text lines (see [example](docs/contextMenus.md))
76+
- Provides optional and customizable right click (control + click on MacOS) context menus for line numbers or text lines (see [example](docs/contextMenus.md))
7777
- Provides auto completion for paired glyphs (\[, \{, \(, \", \') (can be turned on and off).
7878
- If auto complete is turned on, accidentally typed closing glyphs are ignored.
7979
- If auto complete is turned on, selections can be surrounded by paired glyphs.
@@ -125,7 +125,6 @@ For a complete example, please see the [example folder](example/).
125125
- Ctrl: this refers to the Command key on MacOS and the Control key on Linux and Windows.
126126
- Alt: this refers to the Option key on MacOS and the Alt key on Linux and Windows.
127127
- Shift: as you would expect on all platforms.
128-
- Super: this refers to the Control key on MacOS (Dear ImGui reverses Command and Control key on that platform).
129128
- If a keyboard has a left and right version of these modifiers, the meaning is not different.
130129

131130
- Cursor Movements:
@@ -141,7 +140,7 @@ For a complete example, please see the [example folder](example/).
141140
- Panning and Scrolling:
142141
- The text scrolls automatically when you move the cursor through keyboard actions.
143142
- Mouse actions that extend the selections also apply auto scrolling.
144-
- The text in the editor can still be scrolled using those bars that were invented in the 1970's.
143+
- The text in the editor can still be scrolled using those little bars that were invented in the 1970's.
145144
- Devices with scroll wheels or those that simulated vertical and horizontal scroll wheels (like a touch pad, a mouse with a builtin touch pad or a pen) can also scroll the text. This is actually implemented in Dear ImGui (and used by the editor) and must be supported by your backend.
146145
- The middle mouse button on a three-button mouse (or whatever is reported by your OS as a middle mouse button event) enters pan or scroll mode mode depending on the configuration. Pan mode is the default and you can switch this to Scroll mode by calling SetMiddleMouseScrollMode(). Calling SetMiddleMousePanMode() switches it back. The example application uses a menu option to toggle modes.
147146
- In pan mode, the text is grabbed and dragged as the cursor moves and as long as the middle mouse button is down.

TextEditor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3112,6 +3112,9 @@ void TextEditor::Document::deleteText(Coordinate start, Coordinate end) {
31123112
deleteLines(start.line + 1, end.line);
31133113
}
31143114

3115+
// remove marker
3116+
startLine.marker = 0;
3117+
31153118
// mark affected lines for colorization
31163119
auto last = (start.line == lineCount() - 1) ? start.line : start.line + 1;
31173120

@@ -3801,7 +3804,7 @@ void TextEditor::Document::deleteLines(int start, int end) {
38013804
}
38023805
}
38033806

3804-
erase(begin() + start, begin() + end);
3807+
erase(begin() + start, begin() + end + 1);
38053808
}
38063809

38073810

0 commit comments

Comments
 (0)