Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Added delete-to-next/previous-word-boundary #6086

Closed
wants to merge 4 commits into from
Closed

Added delete-to-next/previous-word-boundary #6086

wants to merge 4 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Mar 25, 2015

This is better behavior for alt-del/backspace operations, is less "greedy" and doesn't eat up excess characters.
Also set default key mappings to these, feel free to trash my changes to keymaps/darwin.cson. Though I do feel this should be default behavior, personally.

@ghost
Copy link
Author

ghost commented Apr 15, 2015

Any update on this?

@dogancelik
Copy link

Can someone merge this?

@50Wliu
Copy link
Contributor

50Wliu commented Apr 29, 2015

@CaptSaltyJack could you please rebase this onto latest master? There's conflicts right now.

@ghost
Copy link
Author

ghost commented Apr 29, 2015

@50Wliu My git skills aren't mad enough, I'd probably wind up destroying my repo. Shouldn't I just do git merge master to merge updates into the feature branch?

@benogle
Copy link
Contributor

benogle commented Apr 29, 2015

git checkout master
git pull
git checkout my-branch
git rebase master

then fix all the conflicts

git add ... # all the files conflicted
git rebase --continue

Then when all the conflicts are fixed

git push --force

This is better behavior for alt-del/backspace operations, is less
"greedy" and doesn't eat up excess characters.
Also set default key mappings to these, feel free to trash my changes
to keymaps/darwin.cson. Though I do feel this should be default
behavior, personally.
@ghost
Copy link
Author

ghost commented Apr 29, 2015

Done! git pull did nothing since that was my own remote (origin). I had to merge from upstream/master first.

@benogle
Copy link
Contributor

benogle commented Apr 29, 2015

Oh right, forks.

@ghost
Copy link
Author

ghost commented Apr 29, 2015

Just curious, why rebase over merge? Is it to eliminate all the history I've created, squashing all those commits into a single one?

@50Wliu
Copy link
Contributor

50Wliu commented Apr 29, 2015

Not too sure about rebase vs merge, but I've generally always used rebase when I had conflicting changes.

Also, could you please add your changes to win32.cson and linux.cson if/when the changes to darwin.cson get a 👍?

EDIT: .cson, not .json. Whoops.

@ghost
Copy link
Author

ghost commented Apr 29, 2015

Yeah, as I understand it, rebase wipes out a branch's history. Which I guess is OK when people are merging changes into a project like this. No one needs to see my 20 revisions saying "fixed that one thing again." All that matters is the single commit with one comment as it's merged into upstream/master.

describe "when text is selected", ->
it "deletes only selected text", ->
editor.setSelectedBufferRange([[1, 24], [1, 27]])
editor.deleteToEndOfWord()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be editor.deleteToPreviousWordBoundary()?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lee-dohm Oops.. yes, probably. I don't have the test text handy so I can't verify, but it doesn't make any sense that the test doesn't even call the new function.

@benogle
Copy link
Contributor

benogle commented Apr 30, 2015

Rebasing does not create unnecessary merge commits. Basically its as if you just developed this on the latest version of master. Your history is still there, but the commit shas are different.

@lee-dohm
Copy link
Contributor

I ran the specs from this PR with apm test on Atom change adb0178 on Mac OS X 10.10.3 and both "when no text is selected" tests are failing. Could you fix those, @CaptSaltyJack?

@ghost
Copy link
Author

ghost commented Apr 30, 2015

I could never test this properly because of console errors within Atom when running the (if I recall the name) Package Specs command. To clarify, I tested this thoroughly myself, but the test specs I was never able to verify. @benogle is familiar with the huge headache I went through to try to get the test specs working. I gave up. I apparently can't even run atom -d without errors.

Uncaught TypeError: Cannot read property 'dispatch' of /Users/bob/github/atom/src/space-pen-extension.coffee:64

@lee-dohm
Copy link
Contributor

Ok, I'll take a look and fix the tests 😀

@ghost
Copy link
Author

ghost commented Apr 30, 2015

Even apm test bombs out:

[17216:0429/172638:INFO:CONSOLE(27)] "Error: Module version mismatch. Expected 43, got 41.

It would be cool to have an atom developer's guide somewhere that has clear steps on how to set up a dev environment. I could never get mine 100% functional.

@ghost
Copy link
Author

ghost commented Apr 30, 2015

Thanks @lee-dohm. I'm sure it's something simple/dumb.

@lee-dohm
Copy link
Contributor

You're most welcome @CaptSaltyJack 😃

@benogle
Copy link
Contributor

benogle commented Apr 30, 2015

I am not comfortable changing the default keybinding. I say we merge this without the default bindings changed, and have some folks change their keybindings before changing the default.

@ghost
Copy link
Author

ghost commented Apr 30, 2015

@benogle That makes sense to me. Probably best not to change default behaviors after people are already used to what's been the default since the beginning.

@lee-dohm
Copy link
Contributor

@CaptSaltyJack, I have a question about the third clause to ".deleteToNextWordBoundary() when no text is selected deletes to the next word boundary", starting on line 2384 which is:

          editor.deleteToNextWordBoundary()
          expect(buffer.lineForRow(0)).toBe 'var quicksort = () {'
          expect(buffer.lineForRow(1)).toBe '  var sort = function(it {'
          expect(cursor1.getBufferPosition()).toEqual [0, 15]
          expect(cursor2.getBufferPosition()).toEqual [1, 24]

I corrected the typos and mismatches (row numbers and cursor positions), but the question is that before this portion of the test is executed, the text for line 0 should be var quicksort =|function () { with the pipe character representing the position of the cursor. My understanding is that the intent of this PR is that it is not supposed to be greedy about taking whitespace too. Your test states that the result should be var quicksort =| () {, but the actual result is var quicksort =|() {. Is this a bug?

The same bug appears in the same test on line 2392.

@lee-dohm
Copy link
Contributor

Pushing my updates to fix most of the tests.

@lee-dohm
Copy link
Contributor

Looking to see if I can fix it.

@ghost
Copy link
Author

ghost commented Apr 30, 2015

Geez, was I drunk when I wrote this test? Pushing..

@ghost
Copy link
Author

ghost commented Apr 30, 2015

Unfortunately I can't even test my own code now, as I can't run Atom in dev mode. @benogle, what were the commands to reset the atom dev environment over again? Something about clean, bootstrap, build?

@lee-dohm
Copy link
Contributor

I think you're talking about this command @CaptSaltyJack? apm/node_modules/atom-package-manager/bin/apm rebuild

Oh, no ... got ahead of myself ...

This is generally what I use when I want to reset everything ...

script/clean
script/build

@ghost
Copy link
Author

ghost commented Apr 30, 2015

@lee-dohm Maybe. I'm rebuilding now to see if it fixes atom -d so I can double-check the functionality of my changes.

@lee-dohm lee-dohm mentioned this pull request Apr 30, 2015
@lee-dohm
Copy link
Contributor

Merged as #6575. Thanks @CaptSaltyJack 👍

@lee-dohm lee-dohm closed this Apr 30, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants