Created
September 20, 2019 16:55
-
-
Save zaydek-old/9b699b0c839c5166fad1b6a1b7128483 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// // Insert a tab character. | |
// tab() { | |
// let { data, pos1, pos2 } = editorState // Use `let`. | |
// if (data.slice(pos1, pos2).indexOf("\n") === -1) { | |
// data = data.slice(0, pos1) + "\t" + data.slice(pos2) | |
// pos1 += "\t".length | |
// this.setState({ data, pos1, pos2: pos1 }) | |
// return | |
// } | |
// let x1 = pos1 // Use `let`. | |
// while (x1 - 1 >= 0) { | |
// if (data.charAt(x1 - 1) === "\n") { | |
// break | |
// } | |
// x1-- | |
// } | |
// let x2 = pos2 // Use `let`. | |
// while (x2 < data.length) { | |
// if (data.charAt(x2) === "\n") { | |
// break | |
// } | |
// x2++ | |
// } | |
// const { length } = data // Remember `data`’s length. | |
// data = data.slice(0, x1) + data.slice(x1, x2).replace(/^/gm, "\t") + data.slice(x2) | |
// pos1 += data.length - length // - "\t".length // ?? | |
// pos2 += data.length - length | |
// this.setState({ data, pos1, pos2 }) | |
// }, | |
// // Remove a tab character. | |
// detab() { | |
// // TODO. | |
// }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment