I think there is a macro or two on our site that will do this.
In addition, I believe the tsejr.ui file includes a simple
edit_file_at_cursor macro.
Below is one that while not quite as simple, does work with
spaces, as long as the name is marked or is delimited with '"' or
'<name>'. If the name does not contain spaces, the delimiters
and/or marking are not required.
/***************************************************************
Load a file, whose filename is at the cursor position.
Assigned to <CtrlShift e> in this macro
Examples:
Given two files, "test spaces.s" and "
test.it":
case 1 test spaces.s - must be marked as a block
case 2 <test spaces.s> - no need for block
case 3 "test spaces.s" - no need for block
case 4 "test spaces.s
case 5 <test spaces.s
case 6
test.it - simple filename
test spaces.s> - works if no other text to left
test spaces.s" - works if no other text to left
case 4: works, as long as no extraneous text to the right
case 5: works, as long as no extraneous text to the right
In cases 2, 3, 4, 5, and 7, the cursor can also be placed on
(either) delimiter.
***************************************************************/
integer proc is_left_delimiter()
string delim[1]
integer found_it
// check current character for:
// 1) '<', return found it
delim = GetText(CurrPos(), 1)
if delim == '<'
return (True)
endif
// 2) '"', and another to the right
// return found it
if delim == '"'
PushPosition()
if lFind('"', "c+")
PopPosition()
return (True)
endif
PopPosition()
// if a '"' to the left, return not found
PushPosition()
found_it = lFind('"', "bc")
PopPosition()
return (not found_it)
endif
// otherwise, look to the left '"' or '<'
return (lFind('\"|\<', "bcx"))
end
proc edit_file_at_cursor()
string fn[_MAX_PATH_], delim[1]
if isBlockInCurrFile()
EditThisFile(GetMarkedText())
return ()
endif
// no block in this file - preserve blocks in other files
PushBlock()
PushPosition()
UnMarkBlock()
// check for delimiter on left - right delimiter not required
if is_left_delimiter()
delim = iif(GetText(CurrPos(), 1) == '"', '"', '>')
Right()
MarkChar()
if not lFind(delim, "c")
EndLine()
endif
else
// check for delimiter on right - left delimiter not required
if not lFind('\"|\>', "cx") and not lFind(" ", "c")
EndLine()
endif
MarkChar()
case GetText(CurrPos(), 1)
when '>'
if not lFind('<', "bc")
BegLine()
endif
when '"'
if not lFind('"', "bc")
BegLine()
endif
otherwise
if not lFind(" ", "bc")
BegLine()
endif
endcase
endif
fn = GetMarkedText()
PopPosition()
PopBlock()
EditThisFile(fn)
end
<CtrlShift e> edit_file_at_cursor()
--
Sam Mitchell