jEdit Community - Resources for users of the jEdit Text Editor
Word wrap Shortcut
Submitted by Anonymous on Thursday, 26 February, 2004 - 09:02
Hi! I would like to create a keyboard shortcut to change word wrap mode. I couldn't come up with any way to do this. Maybe I could make a macro that change word wrap mode (or does this exist?), and then bind a key to this macro. How do I change word wrap mode from bean shell?
Any help with this topic would be mush appreciated, thanks!
Spookyy
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Toggle Word Wrap Macro
by lturner on Thu, 26/02/2004 - 09:35
Hi

I just put this simple macro together to toggle through the word wrap settings.

//***********************
Buffer buffer = view.getBuffer();
String currentWrap = buffer.getStringProperty("wrap");

if(currentWrap.equals("none"))
{
buffer.setStringProperty("wrap", "hard");
}
else if(currentWrap.equals("hard"))
{
buffer.setStringProperty("wrap", "soft");
}
else if(currentWrap.equals("soft"))
{
buffer.setStringProperty("wrap", "none");
}

jEdit.propertiesChanged();
//****************************


Hope this helps.

Cheers
Lee
 
Perfect
by Anonymous on Thu, 26/02/2004 - 10:38
Perfect, thanks! I never use hard wrap so I made it like this:
// ToggleWordWrap.bsh - bind to a key
String currentWrap = view.getBuffer().getStringProperty("wrap");
if (currentWrap.equals("none")) {
	buffer.setStringProperty("wrap", "soft");
} else if (currentWrap.equals("soft") || currentWrap.equals("hard")) {
	buffer.setStringProperty("wrap", "none");
}
jEdit.propertiesChanged();
Spookyy
 
Overkill
by Anonymous on Thu, 26/02/2004 - 10:46
// ToggleWordWrap.bsh - bind to a key
if (buffer.getStringProperty("wrap").equals("none")) {
	buffer.setStringProperty("wrap", "soft");
} else { // soft || hard
	buffer.setStringProperty("wrap", "none");
}
jEdit.propertiesChanged();
Spookyy
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293