mod/maxgui.mod/fltkmaxgui.mod/src/Fl_Text_Editor.cxx
int Fl_Text_Editor::handle_key() {
  // Call FLTK's rules to try to turn this into a printing character.
  // This uses the right-hand ctrl key as a "compose prefix" and returns
  // the changes that should be made to the text, as a number of
  // bytes to delete and a string to insert:
  int del = 0;
  if (Fl::compose(del)) {
    if (del) {
      int dp = insert_position(), di = del;
      while (di--) dp = buffer()->prev_char_clipped(dp);
      buffer()->select(dp, insert_position());
    }
    kill_selection(this);
    if (Fl::event_length()) {
      if (insert_mode()) insert(Fl::event_text());
      else overstrike(Fl::event_text());
    }
    show_insert_position();
    set_changed();
    if (when()&FL_WHEN_CHANGED) do_callback();
    return 1;
  }

  int key = Fl::event_key(), state = Fl::event_state(), c = Fl::event_text()[0];
  state &= FL_SHIFT|FL_CTRL|FL_ALT|FL_META; // only care about these states
  Key_Func f;
  f = bound_key_function(key, state, global_key_bindings);
  if (!f) f = bound_key_function(key, state, key_bindings);
  if (f) return f(key, this);
  if (default_key_function_ && !state) return default_key_function_(c, this);
  return 0;
}
/** Handles a key press in the editor */
Handles a key press in the editor
Handles a key press in the editor
int Fl_Text_Editor::handle_key() {
  int del = 0;
  if (Fl::compose(del)) {
    if (del) {
      int dp = insert_position(), di = del;
      while (di--) dp = buffer()->prev_char_clipped(dp);
      buffer()->select(dp, insert_position());
    }
    kill_selection(this);
    if (Fl::event_length()) {
      if (insert_mode()) insert(Fl::event_text());
      else overstrike(Fl::event_text());
    }
    show_insert_position();
    set_changed();
    if (when()&FL_WHEN_CHANGED) do_callback();
    return 1;
  }
  int key = Fl::event_key(), state = Fl::event_state(), c = Fl::event_text()[0];
  state &= FL_SHIFT|FL_CTRL|FL_ALT|FL_META; 
  Key_Func f;
  f = bound_key_function(key, state, global_key_bindings);
  if (!f) f = bound_key_function(key, state, key_bindings);
  if (f) return f(key, this);
  if (default_key_function_ && !state) return default_key_function_(c, this);
  return 0;
}
int Fl_Text_Editor :: handle_key ( ) { int del = 0 ; if ( Fl :: compose ( del ) ) { if ( del ) { int dp = insert_position ( ) , di = del ; while ( di -- ) dp = buffer ( ) -> prev_char_clipped ( dp ) ; buffer ( ) -> select ( dp , insert_position ( ) ) ; } kill_selection ( this ) ; if ( Fl :: event_length ( ) ) { if ( insert_mode ( ) ) insert ( Fl :: event_text ( ) ) ; else overstrike ( Fl :: event_text ( ) ) ; } show_insert_position ( ) ; set_changed ( ) ; if ( when ( ) & FL_WHEN_CHANGED ) do_callback ( ) ; return 1 ; } int key = Fl :: event_key ( ) , state = Fl :: event_state ( ) , c = Fl :: event_text ( ) [ 0 ] ; state &= FL_SHIFT | FL_CTRL | FL_ALT | FL_META ; Key_Func f ; f = bound_key_function ( key , state , global_key_bindings ) ; if ( ! f ) f = bound_key_function ( key , state , key_bindings ) ; if ( f ) return f ( key , this ) ; if ( default_key_function_ && ! state ) return default_key_function_ ( c , this ) ; return 0 ; }
Handles a key press in the editor
Handles a key press in the editor
// Call FLTK's rules to try to turn this into a printing character. // This uses the right-hand ctrl key as a "compose prefix" and returns // the changes that should be made to the text, as a number of // bytes to delete and a string to insert: // only care about these states