From 30733d2d8d435b3e77a51a53b128cb5813becf0f Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 2 Feb 2019 22:04:15 +0100 Subject: Added Fl_Input_::append() method (STR #2953). --- src/Fl_Input_.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src') 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 @@ -743,6 +743,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. -- cgit v1.2.3