Small feature request: option 'both' for Set Gridlinesh=toggle

Ah, that makes sense! Thanks for explaining it.

Here's a button that will toggle horizontal lines in all tabs of the active window.

Only caveat is it won't affect new tabs -- those will still get the main Preferences setting. (Affecting new tabs would probably be better done via a command to change the Preferences option itself, instead of just overriding it for a single tab. We could add that but don't have it at the moment. It could also be done via a script add-in, but writing that is much more complicated than the quick script below.)

For reference, it runs this script code:

// Toggles horizontal grid lines in all tabs in the active window.
// Chooses what to do based on the source tab's state.
// Other tabs (if any) could be out of sync before should be in sync after.
// Does not affect new tabs or other windows; change Preferences for that.
// (Or a script add-in could apply the override when new windows and tabs open.)
function OnClick(clickData)
{
	var tab = clickData.func.sourcetab;
	var lister = tab.lister;
	var cmd = clickData.func.command;
	cmd.deselect = false; // Prevent automatic deselection
	cmd.ClearFiles();

	var cmdLine = "Set GRIDLINESH=";
	if (cmd.IsSet("GRIDLINESH=toggle"))
		cmdLine += "off";
	else
		cmdLine += "on";

	for (var eTab = new Enumerator(lister.tabs); !eTab.atEnd(); eTab.moveNext())
	{
		cmd.SetSourceTab(eTab.item());
		cmd.RunCommand(cmdLine);
	}
}
1 Like