I've extracted my 'switch-last-buffer' macro I'm (heavily) using and added the 'doCenter' parameter b/c this might not be desired by other users.
/**
* switch to the last (used) buffer
*
* @param doCenter if 'true' the buffer is centered<br>
* This could be useful when quick or visually comparing code snippets in 2 files.
*/
_command void switch_last_buffer ( boolean doCenter = false )
Tested with v12.0.3 and v13.0.0.
There is a problem when using 'goto-bookmark' in v12.0.3 resp. 'old-goto-bookmark' in v13.0.0.
An additional patch to 'bookmark.e' would be needed to solve it (same for v12.0.3 and v13.0.0).
bookmark.e - (old_)goto_bookmark():
if ( bm_data != '' ) { /* a valid bookmark was selected */
// HS2-CHG: see below
// switch_buffer(old_buffer_name,'',swold_pos,swold_buf_id);
parse bm_data with bm_id mark_id .;
status=_BookmarkGetInfo(_BookmarkFind(bm_id),
bm_id,mark_id,vsbmflags,buf_id,
0,RealLineNumber,col,BeginLineROffset,
LineData,filename,DocumentName
);
if (status==TEXT_NOT_SELECTED_RC) {
status=_restore_bookmark(filename,RealLineNumber);
if (status) {
return (status);
}
}
begin_select(mark_id,true,true);
if (p_window_state=='I') {
p_window_state='N';
}
// HS2-CHG: switch_buffer should be called AFTER begin_select so the (new) buffer is already activated
switch_buffer(old_buffer_name,'',swold_pos,swold_buf_id);
message(nls('At Bookmark %s',bm_id));
Have fun,
HS2