lib/ffi-tk/widget/text.rb in ffi-tk-2010.01 vs lib/ffi-tk/widget/text.rb in ffi-tk-2010.01.02

- old
+ new

@@ -199,26 +199,22 @@ arguments = arguments.dup invocation = [] indices = [given_index] while arg = arguments.shift - if arg.respond_to?(:to_tcl_option) - case tcl_option = arg.to_tcl_option - when '-command' - command = arguments.shift - invocation << ['-command', command] - when /^-(?:all|image|mark|tag|text|window)$/ - invocation << tcl_option - else - indices.unshift(arg) - end + case arg.to_tcl + when '-command' + command = arguments.shift + invocation << ['-command', command] + when /^-(all|image|mark|tag|text|window)$/ + invocation << tcl_option(arg) else indices.unshift(arg) end end - execute('dump', *invocation, *indices).to_a.each_slice(3).to_a + execute('dump', *invocation, *indices) end # If boolean is not specified, returns the modified flag of the widget. # The insert, delete, edit undo and edit redo commands or the user can set # or clear the modified flag. @@ -657,11 +653,11 @@ # operates on characters in a text rather than entire widgets. # See the bind manual entry for complete details on the syntax of sequence # and the substitutions performed on script before invoking it. # If all arguments are specified then a new binding is created, replacing # any existing binding for the same sequence and tagName (if the first - # character of script is "+" then script augments an existing binding + # character of script is “+” then script augments an existing binding # rather than replacing it). # In this case the return value is an empty string. # If script is omitted then the command returns the script associated # with tagName and sequence (an error occurs if there is no such binding). # If both script and sequence are omitted then the command returns a list @@ -767,12 +763,12 @@ # Returns a list whose elements are the names of all the tags that are # active at the character position given by index. # If index is omitted, then the return value will describe all of the tags # that exist for the text (this includes all tags that have been named in a - # "pathName tag" widget command but have not been deleted by a "pathName - # tag delete" widget command, even if no characters are currently marked + # “pathName tag” widget command but have not been deleted by a “pathName + # tag delete” widget command, even if no characters are currently marked # with the tag). # The list will be sorted in order from lowest priority to highest # priority. def tag_names(index = None) execute(:tag, :names, index).to_a @@ -890,36 +886,8 @@ Tk.execute(:tk_textCut, self) end def paste Tk.execute(:tk_textPaste, self) - end - - def tk_prev_word_pos(start) - Tk.execute('tk::TextPrevPos', self, start, 'tcl_startOfPreviousWord').to_s - end - - def tk_next_word_pos(start) - Tk.execute('tk::TextNextPos', self, start, 'tcl_startOfNextWord').to_s - end - - def tk_next_word_pos_end(start) - Tk.execute('tk::TextNextWord', self, start).to_s - end - - def tk_prev_line_pos(count) - Tk.execute('tk::TextUpDownLine', self, -count.abs).to_s - end - - def tk_next_line_pos(count) - Tk.execute('tk::TextUpDownLine', self, count).to_s - end - - def tk_prev_page_pos(count) - Tk.execute('tk::TextScrollPages', self, -count.abs).to_s - end - - def tk_next_page_pos(count) - Tk.execute('tk::TextScrollPages', self, count).to_s end end end