Add textwrap feature
This commit is contained in:
@@ -16,6 +16,7 @@ import org.fxmisc.richtext.model.TwoDimensional.Position;
|
||||
import app.events.EditorChangedEvent;
|
||||
import app.events.LanguageChangedEvent;
|
||||
import app.events.ToggleCommentEvent;
|
||||
import app.events.ToggleWrapTextEvent;
|
||||
import app.events.FileSaveStateChangedEvent;
|
||||
import app.model.Model;
|
||||
import app.service.LanguageOperations;
|
||||
@@ -99,10 +100,14 @@ public class EditorController implements Initializable, Controller {
|
||||
}
|
||||
}
|
||||
|
||||
private void setWrapText(boolean isWrapText) {
|
||||
this.editor.setWrapText(isWrapText);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the event whenever the content of the editor is changed.
|
||||
*/
|
||||
public void editorChanged() {
|
||||
private void editorChanged() {
|
||||
int offset = this.editor.getCaretPosition();
|
||||
Position pos = this.editor.offsetToPosition(offset, Bias.Forward);
|
||||
this.eventBus.post(new EditorChangedEvent(pos.getMajor() + 1, pos.getMinor()));
|
||||
@@ -131,4 +136,9 @@ public class EditorController implements Initializable, Controller {
|
||||
this.toggleComment();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void handle(ToggleWrapTextEvent event) {
|
||||
this.setWrapText(event.getIsWrapped());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user