@@ -88,7 +88,6 @@ edit_interface_rep::complete_try () {
8888 else {
8989 if ((end == 0 ) || (!is_iso_alpha (s[end - 1 ])) ||
9090 ((end != N (s)) && is_iso_alpha (s[end]))) {
91- complete_str= string (" " );
9291 set_input_normal ();
9392 SERVER (set_completion_popup_visible (false ));
9493 return false ;
@@ -100,7 +99,6 @@ edit_interface_rep::complete_try () {
10099 a = find_completions (drd, et, ss);
101100 }
102101 if (N (a) <= 1 ) {
103- complete_str= string (" " );
104102 set_input_normal ();
105103 SERVER (set_completion_popup_visible (false ));
106104 return false ;
@@ -136,46 +134,26 @@ edit_interface_rep::complete_start (string prefix, array<string> compls) {
136134 completion_prefix= prefix;
137135 completions = close_completions (compls);
138136 completion_pos = 0 ;
139- {
140- // TODO: ?refactor this part to
141- // edit_interface_rep::show_completion_popup
142- cout << " complete_start: "
143- // << "completions=" << completions
144- << " , prefix="
145- << completion_prefix
146- // << ", tp=" << tp
147- // << ", et=" << et
148- // << ", eb=" << eb
149- << LF;
150- array<string> full_completions;
151- for (int i= 0 ; i < N (completions); ++i) {
152- // cout << "complete_start: completions[" << i << "]=" << completions[i]
153- // << LF;
154- string c= completions[i];
155- full_completions << (completion_prefix * c);
156- }
157- path tp1= tp;
158- for (int i= 0 ; i < N (prefix); ++i) {
159- tp1= previous_valid (et, tp1);
160- }
161- cursor cu= eb->find_check_cursor (tp1);
162- cout << " show_completion_popup: "
163- // << "completions=" << full_completions << ", cu->ox=" << cu->ox
164- << " , cu->oy=" << cu->oy << " , magf=" << magf
165- << " , scroll_x=" << get_scroll_x ()
166- << " , scroll_y=" << get_scroll_y ()
167- << " , canvas_x=" << get_canvas_x () << LF;
168- show_completion_popup (tp, full_completions, cu, magf, get_scroll_x (),
169- get_scroll_y (), get_canvas_x ());
137+
138+ array<string> full_completions;
139+ for (int i= 0 ; i < N (completions); ++i) {
140+ string c= completions[i];
141+ full_completions << (completion_prefix * c);
142+ }
143+ path tp1= tp;
144+ for (int i= 0 ; i < N (prefix); ++i) {
145+ tp1= previous_valid (et, tp1);
170146 }
147+ cursor cu= eb->find_check_cursor (tp1);
148+ show_completion_popup (tp, full_completions, cu, magf, get_scroll_x (),
149+ get_scroll_y (), get_canvas_x ());
171150
172151 set_arch_versioning (true );
173152 insert_tree (completions[0 ]);
174153
175154 if (get_input_mode () != INPUT_COMPLETE) {
176155 complete_et = copy (subtree (et, path_up (tp, 1 )));
177156 complete_tp = copy (tp);
178- complete_str= completions[0 ];
179157 }
180158 complete_message ();
181159 // beep ();
@@ -206,12 +184,6 @@ edit_interface_rep::complete_keypress (string key) {
206184 SERVER (set_completion_popup_visible (false ));
207185 return false ;
208186 }
209- // else if (key == "backspace" && N(full_s) == 1) {
210- // complete_str = string("");
211- // set_input_normal ();
212- // SERVER (set_completion_popup_visible (false));
213- // return true;
214- // }
215187 else if ((key != " tab" ) && (key != " S-tab" ) && (key != " up" ) &&
216188 (key != " down" )) {
217189 cout << key << LF;
@@ -243,7 +215,6 @@ edit_interface_rep::complete_keypress (string key) {
243215 }
244216 if (completion_pos < 0 ) completion_pos= N (completions) - 1 ;
245217 if (completion_pos >= N (completions)) completion_pos= 0 ;
246- complete_str= completions[completion_pos];
247218 new_s = completions[completion_pos];
248219
249220 remove (path_up (tp) * (end - N (old_s)), N (old_s));
@@ -321,7 +292,6 @@ edit_interface_rep::custom_complete (tree r) {
321292 // cout << prefix << ", " << compls << LF;
322293
323294 if ((prefix == " " ) || (N (compls) <= 1 )) {
324- complete_str= string (" " );
325295 set_input_normal ();
326296 SERVER (set_completion_popup_visible (false ));
327297 return ;
0 commit comments