- Timestamp:
- Sep 18, 2010, 5:07:40 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- 2ec737f
- Parents:
- 4811422
- git-author:
- David Benjamin <davidben@mit.edu> (08/15/10 19:15:19)
- git-committer:
- David Benjamin <davidben@mit.edu> (09/18/10 17:07:40)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
viewwin.c
r6a35938 r09ceee3 61 61 v->content = owl_window_new(v->window); 62 62 v->status = owl_window_new(v->window); 63 v->cmdwin = NULL; 63 64 64 65 v->sig_content_redraw_id = … … 84 85 owl_window_get_position(v->window, &lines, &cols, NULL, NULL); 85 86 owl_window_set_position(v->content, lines - BOTTOM_OFFSET, cols, 0, 0); 87 /* Only one of these will be visible at a time: */ 86 88 owl_window_set_position(v->status, BOTTOM_OFFSET, cols, lines - BOTTOM_OFFSET, 0); 89 if (v->cmdwin) 90 owl_window_set_position(v->cmdwin, BOTTOM_OFFSET, cols, lines - BOTTOM_OFFSET, 0); 87 91 } 88 92 … … 136 140 } 137 141 wattroff(curswin, A_REVERSE); 142 } 143 144 char *owl_viewwin_start_command(owl_viewwin *v, int argc, const char *const *argv, const char *buff) 145 { 146 owl_editwin *tw; 147 owl_context *ctx; 148 149 buff = skiptokens(buff, 1); 150 151 tw = owl_viewwin_set_typwin_active(v, owl_global_get_cmd_history(&g)); 152 owl_editwin_set_locktext(tw, ":"); 153 154 owl_editwin_insert_string(tw, buff); 155 156 ctx = owl_editcontext_new(OWL_CTX_EDITLINE, tw, "editline"); 157 ctx->deactivate_cb = owl_viewwin_deactivate_editcontext; 158 ctx->cbdata = v; 159 owl_global_push_context_obj(&g, ctx); 160 owl_editwin_set_callback(tw, owl_callback_command); 161 162 return NULL; 163 } 164 165 void owl_viewwin_deactivate_editcontext(owl_context *ctx) { 166 owl_viewwin *v = ctx->cbdata; 167 owl_viewwin_set_typwin_inactive(v); 168 } 169 170 owl_editwin *owl_viewwin_set_typwin_active(owl_viewwin *v, owl_history *hist) { 171 int lines, cols; 172 if (v->cmdwin || v->cmdline) 173 return NULL; 174 /* Create the command line. */ 175 v->cmdwin = owl_window_new(v->window); 176 owl_viewwin_layout(v); 177 owl_window_get_position(v->cmdwin, &lines, &cols, NULL, NULL); 178 v->cmdline = owl_editwin_new(v->cmdwin, lines, cols, OWL_EDITWIN_STYLE_ONELINE, hist); 179 /* Swap out the bottom window. */ 180 owl_window_hide(v->status); 181 owl_window_show(v->cmdwin); 182 return v->cmdline; 183 } 184 185 void owl_viewwin_set_typwin_inactive(owl_viewwin *v) { 186 if (v->cmdwin) { 187 /* Swap out the bottom window. */ 188 owl_window_hide(v->cmdwin); 189 owl_window_show(v->status); 190 /* Destroy the window itself. */ 191 owl_window_unlink(v->cmdwin); 192 g_object_unref(v->cmdwin); 193 v->cmdwin = NULL; 194 } 195 if (v->cmdline) { 196 owl_editwin_unref(v->cmdline); 197 v->cmdline = NULL; 198 } 138 199 } 139 200 … … 282 343 v->onclose_hook_data = NULL; 283 344 } 345 owl_viewwin_set_typwin_inactive(v); 284 346 /* TODO: This is far too tedious. owl_viewwin should own v->window 285 347 * and just unlink it in one go. Signals should also go away for
Note: See TracChangeset
for help on using the changeset viewer.