summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-06-21 22:37:39 +0000
committerBram Moolenaar <Bram@vim.org>2005-06-21 22:37:39 +0000
commitd857f0e0f419ffcc8a17d2724d5f3fa62da590a7 (patch)
tree0a5a35fc6d2861e18bc87f4a91652198a7a6e60b /src/window.c
parent3f7704760770fb4382f61b27ae7762365db5c70a (diff)
downloadvim-git-d857f0e0f419ffcc8a17d2724d5f3fa62da590a7.tar.gz
updated for version 7.0089v7.0089
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/window.c b/src/window.c
index e57976c77..c9c6c99ab 100644
--- a/src/window.c
+++ b/src/window.c
@@ -458,11 +458,8 @@ do_window(nchar, Prenum, xchar)
case 'f':
case Ctrl_F:
CHECK_CMDWIN
-#ifdef FEAT_VISUAL
- reset_VIsual_and_resel(); /* stop Visual mode */
-#endif
- ptr = file_name_at_cursor(FNAME_MESS|FNAME_HYP|FNAME_EXP,
- Prenum1);
+
+ ptr = grab_file_name(Prenum1);
if (ptr != NULL)
{
#ifdef FEAT_GUI
@@ -4478,6 +4475,30 @@ last_status_rec(fr, statusline)
#if defined(FEAT_SEARCHPATH) || defined(PROTO)
/*
+ * Get the file name at the cursor.
+ * If Visual mode is active, use the selected text if it's in one line.
+ * Returns the name in allocated memory, NULL for failure.
+ */
+ char_u *
+grab_file_name(count)
+ long count;
+{
+# ifdef FEAT_VISUAL
+ if (VIsual_active)
+ {
+ int len;
+ char_u *ptr;
+
+ if (get_visual_text(NULL, &ptr, &len) == FAIL)
+ return NULL;
+ return find_file_name_in_path(ptr, len,
+ FNAME_MESS|FNAME_EXP|FNAME_REL, count, curbuf->b_ffname);
+ }
+# endif
+ return file_name_at_cursor(FNAME_MESS|FNAME_HYP|FNAME_EXP|FNAME_REL, count);
+}
+
+/*
* Return the file name under or after the cursor.
*
* The 'path' option is searched if the file name is not absolute.