For my readme i guess
forivall / atom-hard-wrap Goto Github PK
View Code? Open in Web Editor NEW:ribbon: Hard wrap lines in atom - enhanced version of core autoflow
License: MIT License
:ribbon: Hard wrap lines in atom - enhanced version of core autoflow
License: MIT License
Hello!
Thanks for your package. However, it seems not working with non-latin characters (I use Cyrillic alphabet).
Thank you for making this package! It is very handy. I use it to format comments and markdown every day at work.
It would be a really neat feature, if this package supported comments, now only the first line remains a comment when wrapped and the comment symbol(s) are not applied to the wrapped lines.
This will be reflowed correctly:
// foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
// bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar
But this - will not:
// foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
//
// bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar
I would not say it is something critical, but it should be taken into account.
Hi. First of all, thanks for programming this, it has been very useful! I had a slight issue with the reflow feature though. When a paragraph starts with a "-" symbol (a dash), if I run the command Ctrl+Alt+y, then a "-" is included at the beginning of every line.
Maybe there is a similar phenomenon with other symbols other than "-", I'm not sure. It would be great if you could fix it. Thanks!
The contents of atom-text-editor
elements are no longer encapsulated
within a shadow DOM boundary. Please, stop using rootElement
and access
the editor contents directly instead.
HTMLElement.rootElement (C:\Users\Username\AppData\Local\atom\app-1.25.1\resources\app.asar\src\text-editor-element.js:23:10)
Object.getWrapColumn (C:\Users\Username\.atom\packages\hard-wrap\lib\hard-wrap.js:55:41)
<unknown> (C:\Users\Username\.atom\packages\hard-wrap\lib\hard-wrap.js:91:30)
TextBuffer.transact (<embedded>:33568:24)
TextEditor.transact (<embedded>:4033:30)
Object.reflowSelection (C:\Users\Username\.atom\packages\hard-wrap\lib\hard-wrap.js:81:12)
Error: Cannot find module 'underscore-plus'
at Module._resolveFilename (module.js:455:15)
at Module._resolveFilename (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\electron.asar\common\reset-search-paths.js:35:12)
at Function.get_Module._resolveFilename (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\src\module-cache.js:354:58)
at Module.require (file:///C:/Users/Sujash/AppData/Local/atom/app-1.18.0/resources/app/static/index.js:40:43)
at require (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\src\native-compile-cache.js:66:33)
at Object. (file:///C:/Users/Sujash/.atom/packages/atom-hard-wrap-master/lib/hard-wrap.js:4:11)
at Module.get_Module._compile (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\src\native-compile-cache.js:106:36)
at Object.value [as .js] (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\src\compile-cache.js:239:29)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (file:///C:/Users/Sujash/AppData/Local/atom/app-1.18.0/resources/app/static/index.js:47:45)
at require (internal/module.js:20:19)
at customRequire (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\static<embedded>:96:26)
at Package.module.exports.Package.requireMainModule (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\src\package.js:887:35)
at Package.module.exports.Package.activateNow (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\src\package.js:242:22)
at C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\src\package.js:968:31
at Function.module.exports.Emitter.simpleDispatch (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\node_modules\event-kit\lib\emitter.js:25:20)
at Emitter.module.exports.Emitter.emit (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\node_modules\event-kit\lib\emitter.js:141:34)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\src\command-registry.js:246:26)
at CommandRegistry.handleCommandEvent (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\src\command-registry.js:3:65)
at CommandRegistry.module.exports.CommandRegistry.dispatch (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\src\command-registry.js:166:25)
at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\src\atom-environment.js:1314:34)
at EventEmitter.outerCallback (C:\Users\Sujash\AppData\Local\atom\app-1.18.0\resources\app\src\application-delegate.js:334:31)
at emitThree (events.js:116:13)
at EventEmitter.emit (events.js:194:7)
Cannot build using APM
on «Windows 10 (^^)»
.
Seems to be another node-gyp
issue...
Any idea or workaround ?
Where can I found interesting logs about this issue ?
Thanks.
R.
When trying to wrap the last line of this Markdown list by starting my selection at "After":
- Subsequent lines should be wrapped at 72 characters.
- After editing a paragraph, you can re-wrap it by pressing escape, ensuring the cursor is within the paragraph and typing <code>gqip</code>.
It ends up like this:
- Subsequent lines should be wrapped at 72 characters.
- After editing a paragraph, you can re-wrap it by pressing escape, ensuring the
cursor is within the paragraph and typing <code>gqip</code>.
After wrapping, the word "the" is overflowing the 80 character line length by two characters. If I instead start the selection on the start of the line, I get this:
- Subsequent lines should be wrapped at 72 characters.
- After editing a paragraph, you can re-wrap it by pressing escape, ensuring
- the cursor is within the paragraph and typing <code>gqip</code>.
While the above is cool in terms of built-in intelligence on preserving the -
and indentation, this leads to breaking my Markdown list. While it would be awesome if Markdown was understood, I don't expect that from a plugin like this, so instead it would be nice if I could just start the selection after the -
character and then have it wrapped at the 80 character line length counted from the start of the line instead of from the start of the selection.
It would then of course be incredible if the wrapped text was indented to where my selection starts.
hard-wrap stops working in atom 1.22.The following patch fixes the extension:
80c80,81
< range = editor.rowRangeForParagraphAtBufferRow(range.getRows()[0])
---
> range = editor.languageMode.
> rowRangeForParagraphAtBufferRow(range.getRows()[0])
The default behavior is to repeat the markup when paragraphs starts with them:
**bolt text* test test test test test test test test test test test test test test
**bolt text* test test test test test test test test test test test
**test test test
Lists won't work either:
- First item test some test some test some test some test some test some test some test
- Second item test some test some test some test some test some test some test some test
- First item test some test some test some test some test some test some test
- some test Second item test some test some test some test some test some test
- some test some test
I guess this would require an option or a language-specific wrap.
Thanks for the package.
First, thanks for creating this very useful package! I do have a small bug to report, though. When wrapping, it seems like selected linefeeds are removed. For example, when I mark the whole first line (place the marker on the line and press ⇧↓) below and wrap it:
- The first line should be limited to 50 characters and should not end with a period.
- Subsequent lines should be wrapped at 72 characters.
It looks like this afterwards:
- The first line should be limited to 50 characters and should not end with a
- period. - Subsequent lines should be wrapped at 72 characters.
If I don't mark the entire row (instead press ⇧⌘→) and thus excluding the linefeed from the selection, it is wrapped correctly. Having to exclude the ending linefeed from the selection is a bit annoying, since that makes selecting text a bit more fiddly.
Atom: 1.22.0 x64
Electron: 1.6.15
OS: Mac OS X 10.13.1
Thrown From: hard-wrap package 1.1.0
Uncaught TypeError: editor.languageMode.rowRangeForParagraphAtBufferRow is not a function
At /Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:959
TypeError: editor.languageMode.rowRangeForParagraphAtBufferRow is not a function
at /packages/hard-wrap/lib/hard-wrap.js:81:13
at TextBuffer.module.exports.TextBuffer.transact (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:952:24)
at TextEditor.module.exports.TextEditor.transact (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1687:32)
at Object.reflowSelection (/packages/hard-wrap/lib/hard-wrap.js:75:12)
at HTMLElement.hardWrapReflowSelection (/packages/hard-wrap/lib/hard-wrap.js:23:48)
at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:381:36)
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:100:42)
at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:3:65)
20x -1:48.6.0 core:select-left (input.hidden-input)
-1:47.5.0 core:cut (input.hidden-input)
-1:47.4.0 core:backspace (input.hidden-input)
17x -1:47.1.0 core:move-left (input.hidden-input)
-1:46.2.0 core:move-right (input.hidden-input)
-1:46 core:paste (input.hidden-input)
-1:45.5.0 core:backspace (input.hidden-input)
-1:45.1.0 core:save (input.hidden-input)
-0:34.2.0 pane:show-previous-item (input.hidden-input)
2x -0:21.9.0 core:move-right (input.hidden-input)
-0:21.1.0 core:move-left (input.hidden-input)
-0:17.2.0 hard-wrap:reflow-selection (input.hidden-input)
-0:14.7.0 editor:consolidate-selections (input.hidden-input)
-0:14.7.0 core:cancel (input.hidden-input)
-0:14.3.0 core:save (input.hidden-input)
-0:13.2.0 hard-wrap:reflow-selection (input.hidden-input)
busy-signal 1.4.3
file-icons 2.1.13
go-debug 1.5.2
go-plus 5.6.0
go-signature-statusbar 1.2.3
hard-wrap 1.1.0
hyperclick 0.1.5
intentions 1.1.5
language-docker 1.1.8
language-nginx 0.8.0
linter 2.2.0
linter-ui-default 1.6.10
sort-lines 0.18.0
Nice package! It's coming in very handy today.
If I try to hard-wrap:reflow-selection
in an empty paragraph, i.e. where the X is in the following code block:
...
end of some paragraph.
X
Start of another paragraph...
I receive the error Uncaught TypeError: Cannot read property 'start' of undefined
. I expected nothing to happen.
Hi,
Nifty extension...
With this text:
An object indicating tags whose types and names/namepaths (whether defining or referencing namepaths) will be checked, subject to configuration. If the tags have predefined behavior or `allowEmptyNamepaths` behavior, this option will override that behavior for any specified tags, though this option can also be used for tags without predefined behavior. Its keys are tag names and its values are objects with the following optional properties:
I'm getting:
An object indicating tags whose types and names/namepaths (whether defining or
referencing namepaths) will be checked, subject to configuration. If the tags
have predefined behavior or `allowEmptyNamepaths` behavior, this option will
override that behavior for any specified tags, though this option can also be
used for tags without predefined behavior. Its keys are tag names and its values
are objects with the following optional properties:
where the last "values" gets to line 81 (above the default 80 shown in the editor prefs).
Replacing backticks, slashes, and parentheses doesn't change it, so I wouldn't imagine the issue is with special characters.
Thanks!
Could you modify hard-wrap to use the current line as the selection, if there is no current selection? I find myself hitting CNTL+ALT+Y without a selection and get an UncaughtTypeError.
Noticing that hard-wrap fails to wrap when a period surrounded by backticks crosses the line lenght border. For example, when line length is set at 80, and I have the three characters `.` at column 79, 80, and 81, hard-wrap does not wrap the `.` sequence to next line, but leaves it hanging beyond the line length. I can reproduce the error with a longer sequence: `......` and all of it stays hanging past the line length. If I have characters other than period inside the ticks, it wraps as expected.
When I attempt to install, it just keeps installing without stopping. It doesn't quit installing or give any error, it just never finishes installing.
People prefer different line lengths depending on the language. While the editor's global setting is a good start, I think a language-specific setting should override it.
I don't know whether this is possible with the current API, but if so, it should be implemented.
I usually stick to 80 chars, but go up to 99 for Rust or even 160 for C++.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.