Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add line numbers to preview window #31

Closed
batjko opened this issue Jul 28, 2014 · 16 comments
Closed

Add line numbers to preview window #31

batjko opened this issue Jul 28, 2014 · 16 comments

Comments

@batjko
Copy link

batjko commented Jul 28, 2014

I wonder if it's worthwhile having a gutter with line numbers on the preview.

I'm thinking of the ability to point out relationships between a line in the left with one in the right - say, via further plugins, or even just in screenshots, drawing arrows by hand if one wanted to. For example for documentation, tutorials etc:
"See how differently this is implemented in coffeescript versus javascript in line 5 / 10"...

@Glavin001
Copy link
Owner

+1 I have been thinking about line numbers as well. I wonder what the best way to do this would be..

@batjko
Copy link
Author

batjko commented Jul 28, 2014

Well, mate... I'm counting on your to figure that out. But I have faith in you. 👍

@Glavin001
Copy link
Owner

Hahahaha oh, thanks!

I have also been thinking about making the PreviewView an actual EditorView with an Editor and Atom Preview would act as a virtual Atom user and apply changes to the Editor (model) which would propagate to the EditorView. This would make this issue, #25 (font-size syncing), and #27 (theme applying) mute because all of those are to make the PreviewView act like an EditorView.

Now to figure out the best way to do that.. 😉.

/cc @ddavison @kevinsawicki

@kevinsawicki
Copy link

I would guess you could start by extending EditorView and use it with an untitled buffer that you update with the preview text.

The main issue is that there isn't an API yet for creating a read-only editor so by default save, editing, will be possible.

@batjko
Copy link
Author

batjko commented Jul 28, 2014

That may be too naive here, but could you listen to a key-down event in that preview pane and prevent Default from inserting a character?

@kevinsawicki
Copy link

That might work, you may want to try first just hiding the input element as well.

That won't cover commands triggered via the command palette or system menus though, you'll need to override some methods in Editor to make them no-ops for those commands.

@Glavin001
Copy link
Owner

I think I'd be willing to sacrifice the forceful read-only, especially if users are thinking of using it for saving purposes versus my original intention of view-only. If it does bother too many users I'm sure we can figure something out when the time comes.

@kevinsawicki is there any documentation / packages source code that you'd recommend I read over to get started developing such that it is a true EditorView? I'm getting fairly familiar with the Atom source code, however it would be nice to see another package that creates it's own EditorView in a new tab so I could see an example of what that would look like.

Hopefully this is something we (or I 😉) could wrap up tonight and squash out 3 issues in one! 👍

@kevinsawicki
Copy link

Tons of packages create EditorViews but they usually use the mini option which makes it like a single line input field, I'm unaware of any packages that extend EditorView for this type if wrapping, sorry.

@Glavin001
Copy link
Owner

No problem. I should be okay with the extending. I'll keep everyone posted on my progress later tonight. Thank you again for your help and support!

@batjko
Copy link
Author

batjko commented Jul 28, 2014

Great job so far @Glavin001!

@ddavison
Copy link
Collaborator

👍

@Glavin001
Copy link
Owner

@ddavison which issues would you like to tackle? Maybe this is something of interest to you 😉

@ddavison
Copy link
Collaborator

@Glavin001 If you don't take it again. two issues assigned to me were handled by you! 😆

@Glavin001
Copy link
Owner

Sorry, I do that sometimes 😆 .. All yours 😄 !

@Glavin001 Glavin001 changed the title Request: Add line numbers to preview window Add line numbers to preview window Jul 28, 2014
@rprieto
Copy link

rprieto commented Aug 11, 2014

Just confirming I installed the new 0.9.0 update and it works like a charm. Just needed a manual Window: reload.

Thanks!

@Glavin001
Copy link
Owner

Thank you for testing and letting me know! Really glad to hear it is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants