-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor so buffer operations directly trigger window rendering This allows all buffer operations to be able to attempt to preserve scroll position without having to go through the Window object. Window.append should probably be deprecated, except perhaps as a convenience extension * Treat onBufModifyPre/Post as a renderer transaction in JLineWindow This drastically simplifies the JLineBuffer implementation; we may even be able to just replace it with a factory function * Handle buffer clearing * Remove Buffer append marshalling through the Window * Minor Cleanup
- Loading branch information
Showing
8 changed files
with
222 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 2 additions & 32 deletions
34
jline/src/main/kotlin/net/dhleong/judo/jline/JLineBuffer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,17 @@ | ||
package net.dhleong.judo.jline | ||
|
||
import net.dhleong.judo.inTransaction | ||
import net.dhleong.judo.render.FlavorableCharSequence | ||
import net.dhleong.judo.render.IdManager | ||
import net.dhleong.judo.render.JudoBuffer | ||
|
||
/** | ||
* @author dhleong | ||
*/ | ||
class JLineBuffer( | ||
private val renderer: JLineRenderer, | ||
renderer: JLineRenderer, | ||
ids: IdManager, | ||
scrollbackSize: Int = DEFAULT_SCROLLBACK_SIZE | ||
) : JudoBuffer( | ||
ids, | ||
renderer.settings, | ||
scrollbackSize | ||
) { | ||
override fun append(text: FlavorableCharSequence) = renderer.inTransaction { | ||
super.append(text) | ||
} | ||
|
||
override fun appendLine(line: FlavorableCharSequence) = renderer.inTransaction { | ||
super.appendLine(line) | ||
} | ||
|
||
override fun clear() = renderer.inTransaction { | ||
super.clear() | ||
} | ||
|
||
override fun deleteLast(): FlavorableCharSequence = renderer.inTransaction { | ||
return super.deleteLast() | ||
} | ||
|
||
override fun replaceLastLine(result: FlavorableCharSequence) = renderer.inTransaction { | ||
super.replaceLastLine(result) | ||
} | ||
|
||
override fun set(newContents: List<FlavorableCharSequence>) = renderer.inTransaction { | ||
super.set(newContents) | ||
} | ||
|
||
override fun set(index: Int, line: FlavorableCharSequence) = renderer.inTransaction { | ||
super.set(index, line) | ||
} | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.