On Mon, Feb 01, 2016 at 09:55:32PM +0100, Silvan Jegen wrote: > There are still a lot of rough edges. We don't change the jumplist for > example, which means that we won't be able to jump back to the old > file.
The jumplist is almost inexistent anyway, for starters it is currently only local to the current file. A few remarks about the implementation below ... > + [VIS_ACTION_OPEN_FILE_UNDER_CURSOR] = { > + "open-file-under-cursor", > + "Open file under the cursor", > + call, { .f = vis_open_file } > + }, > + [VIS_ACTION_OPEN_FILE_UNDER_CURSOR_NEW_WINDOW] = { > + "open-file-under-cursor-new_window", > + "Open file under the cursor in a new window", > + call, { .f = vis_open_file_new_window } > + }, Instead of adding new functions to vis.[ch] and using indirection via "call", add one "open_file_under_cursor" function to main.c. This function should inspect its arg->b parameter and depending on that open the new file either in the current or a new window. > +int is_filename_boundry(int c) { > + return isspace(c) || (c == ';' || > + c == '"' || c == '\'' ); Should be static, funny indentation, useless parenthesis? > +size_t text_filename_start_prev(Text *txt, size_t pos) { > + return text_customword_start_prev(txt, pos, is_filename_boundry); > +} > + > +size_t text_filename_end_next(Text *txt, size_t pos) { > + return text_customword_end_next(txt, pos, is_filename_boundry); > +} Instead of introducing these one should write a Filerange text_object_filename(Text *txt, size_t pos) which would also take care of any needed offsets. Also I'm not sure whether using the "customword" functions is a good idea due to their behavior if you are already at the start/end of the word. Maybe the actual file opening should be implemented using the :edit command via vis_cmd(...) this would also take care about detecting unsaved changes etc. -- Marc André Tanner >< http://www.brain-dump.org/ >< GPG key: 10C93617