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

added position argument so pick doesn't clear the screen every time #95

Merged
merged 16 commits into from
Apr 22, 2024
Merged

added position argument so pick doesn't clear the screen every time #95

merged 16 commits into from
Apr 22, 2024

Conversation

Cornelius-Figgle
Copy link
Contributor

@Cornelius-Figgle Cornelius-Figgle commented Dec 24, 2022

#94 #50
I have added the position argument to the pick module, so that a specific write-point can be provided. This means that pick won't clear the screen when running in an existing curses window

position is a dictionary with the keys y0 and x0, which correspond to the y and x locations respectively. Default position is the same as previously, now written as {"y0": 1, "x0": 1}

Forked repo here

y_, _ = screen.getyx()
answer, _ = pick(
    ['Yes', 'No'], 
    f'\nIs This Path Correct? \t{path}',
    screen=screen,
    position={'y0': y_, 'x0': 0}
)

Summary by CodeRabbit

  • New Features

    • Introduced an optional position parameter to set the initial cursor position in the user interface.
    • Added a new example file demonstrating the selection of programming languages via a user interface.
  • Documentation

    • Updated README with a short summary of new features.

src/pick/__init__.py Outdated Show resolved Hide resolved
Copy link
Contributor

coderabbitai bot commented Apr 11, 2024

Walkthrough

The update introduces an optional position parameter that allows setting the initial write position in a curses application when using pick. This enhancement provides more control over user interaction and cursor placement, improving the overall user experience.

Changes

File Path Change Summary
README.md Added an optional position parameter for setting initial write position in pick.
example/position.py Introduces functionality for selecting a programming language using a UI.
src/pick/__init__.py Added Position namedtuple, updated Picker class methods to handle position.

🐰✨
In the code where the cursor blinks,
A new spot to start, what do you think?
With a hop and a skip, set the position,
Now picking choices with new precision!
🌟🐇


Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 1c08d5f and 887af61.
Files selected for processing (1)
  • README.md (1 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Actionable comments outside the diff hunks (1)
src/pick/__init__.py (1)

Line range hint 166-166: Avoid using a bare except statement. Specify the exceptions you expect to handle to prevent masking other unexpected issues.

-        except:
+        except Exception as e:

example/position.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

README.md Outdated Show resolved Hide resolved
example/position.py Outdated Show resolved Hide resolved
@aisk
Copy link
Owner

aisk commented Apr 19, 2024

Hi, I think this change looks good to me, but before merge, we need to resolve the conflicts.

@Cornelius-Figgle
Copy link
Contributor Author

Is that something for me or you to do? If it's me, how?

@aisk
Copy link
Owner

aisk commented Apr 19, 2024

You can execute git fetch && git merge in this branch, and if you are using a modern editor like VSCode, you can resolve the conflict when you open the __init__.py in it.

Otherwise, you can edit the file as normal file, and edit it by hand, to make it as what it expected to commit. After that, just running git add <the file and git commit && git push.

Last way is click the Resolve conficts button bellow. but it lacks of context, I only recomented use it unless you have confident.

@Cornelius-Figgle
Copy link
Contributor Author

You can execute git fetch && git merge in this branch

Did this, nothing happened other than the normal output like with git pull

Otherwise, you can edit the file as normal file, and edit it by hand, to make it as what it expected to commit

I went to edit the file and it looked the same as what I had committed? I didn't change anything so there's nothing to push back

Do I use GitHub's Resolve conflicts now then? Or have I done something wrong... I apologise for my inadequacy 😅

@aisk
Copy link
Owner

aisk commented Apr 20, 2024

You can have a try to use the Resolve conficts button. It will append a new commit to your branch, so please be sure to check and test the code locally after use it.

@Cornelius-Figgle
Copy link
Contributor Author

done :)

example/position.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@aisk aisk merged commit c72f339 into aisk:master Apr 22, 2024
18 checks passed
@aisk
Copy link
Owner

aisk commented Apr 22, 2024

Thank you for your contribution, merged!

@aisk aisk mentioned this pull request Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants