summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <git@matthiasm.com>2019-02-02 22:04:15 +0100
committerMatthias Melcher <git@matthiasm.com>2019-02-02 22:04:15 +0100
commit30733d2d8d435b3e77a51a53b128cb5813becf0f (patch)
tree97976315c0e486ae7208b014c2414e6bbbe4ab3a /src
parent5062b5a01041772e123f30b9e65de95d82d865a7 (diff)
Added Fl_Input_::append() method (STR #2953).
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Input_.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx
index ef6900d6e..7ca8ff0f9 100644
--- a/src/Fl_Input_.cxx
+++ b/src/Fl_Input_.cxx
@@ -744,6 +744,30 @@ static void undobuffersize(int n) {
}
/**
+ Append text at the end.
+
+ This function appends the string in \p t to the end of the text.
+ It does not moves the new position or mark.
+
+ \param [in] t text that will be appended
+ \param [in] l length of text, or 0 if the string is terminated by \c nul.
+ \param [in] keep_selection if this is 1, the current text selection will
+ remain, if 0, the cursor will move to the end of the inserted text.
+ \return 0 if no text was appended
+ */
+int Fl_Input_::append(const char* t, int l, char keep_selection)
+{
+ int end = size();
+ int om = mark_, op = position_;
+ int ret = replace(end, end, t, l);
+ if (keep_selection) {
+ position(op, om);
+ }
+ return ret;
+}
+
+
+/**
Deletes text from \p b to \p e and inserts the new string \p text.
All changes to the text buffer go through this function.