jareditor 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80a9dc0c47c5996efc1a2f972a7bd386df1b0ba8
4
- data.tar.gz: fcb4d4a2be5618a9886d94c93de053722e46ff53
3
+ metadata.gz: a7c8e3df3bf5baf5322111c11ee4c374bd466cd0
4
+ data.tar.gz: 658397e3d424c784a722faebe74a5821ac51dbbb
5
5
  SHA512:
6
- metadata.gz: dcef45d4611e3301c79d8597fcf4f6aa44fb7482567105ed8dc37af47a2dee9f715bce0f3244adfa0d28b065a0c7e7ee1303fb2daef2160409d1150e07be7164
7
- data.tar.gz: 8482fd9cad5da24d0677e1e990e79d56de967ccada9059171bc535682b16bcac0c7601369a55e9e2ee381dbf0f5de8188ac4b1857c68920159a49cc76f2e5c8d
6
+ metadata.gz: 0122f6e42df9b6696b1de598c6b182047d05948b06dffa8833aac7eaf4f18df68d56325a64c468f597e9fab69650c16af797a1cc39477d1dabd97c283c3fd2ba
7
+ data.tar.gz: c592be92a95219df7f0506c143f40f022382170cf348fe2da81fd002d61d0bd80289fa8b204032b7e705ca5650fcdd8d08b76fccc639233b3e05850be2d2e217
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # JarEd
2
2
 
3
- The worst text editor.
3
+ The jerk's text editor.
4
4
 
5
5
  ## Installation
6
6
 
@@ -24,7 +24,7 @@ git commits and tags, and push the `.gem` file to
24
24
 
25
25
  ## Roadmap
26
26
 
27
- - [ ] Opening files
27
+ - [x] Opening files
28
28
  - [ ] Inserting text
29
29
  - [ ] Deleting text
30
30
  - [ ] Saving files
data/jareditor.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Jared Norman"]
10
10
  spec.email = ["jared@creepywizard.com"]
11
11
 
12
- spec.summary = "The worst text editor."
13
- spec.description = "The worst text editor."
12
+ spec.summary = "The jerk's text editor."
13
+ spec.description = "The jerk's text editor."
14
14
  spec.homepage = "https://github.com/jarednorman/jared"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
data/lib/jared.rb CHANGED
@@ -6,11 +6,23 @@ require "jared/buffer"
6
6
  module JarEd
7
7
  class << self
8
8
  def start(args)
9
- pane.buffer = Buffer.new File.open(args[0], "r")
9
+ buffer = Buffer.new File.open(args[0], "r")
10
+ pane.buffer = buffer
10
11
 
11
12
  take_input do |char|
13
+ case char
14
+ when "h"
15
+ buffer.cursor(0, -1)
16
+ when "j"
17
+ buffer.cursor(1, 0)
18
+ when "k"
19
+ buffer.cursor(-1, 0)
20
+ when "l"
21
+ buffer.cursor(0, 1)
22
+ when "\e"
23
+ break
24
+ end
12
25
  pane.refresh(window)
13
- break if char == "\e"
14
26
  end
15
27
  end
16
28
 
@@ -33,8 +45,8 @@ module JarEd
33
45
  begin
34
46
  Curses.crmode
35
47
  Curses.noecho
36
-
37
48
  Curses.refresh
49
+
38
50
  yield nil
39
51
  Curses.doupdate
40
52
 
data/lib/jared/buffer.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  module JarEd
2
2
  class Buffer
3
3
  attr_reader :window_position,
4
- :cursor_line,
4
+ :cursor_row,
5
5
  :cursor_column
6
6
 
7
7
  def initialize(file)
8
8
  @file = file
9
9
  @window_position = 0
10
- @cursor_line = 0
10
+ @cursor_row = 0
11
11
  @cursor_column = 0
12
12
  end
13
13
 
@@ -15,6 +15,12 @@ module JarEd
15
15
  @lines ||= file.each_line.to_a
16
16
  end
17
17
 
18
+ # @todo Restrict cursor position to file/line length.
19
+ def cursor(rows, columns)
20
+ @cursor_row = [0, cursor_row + rows].max
21
+ @cursor_column = [0, cursor_column + columns].max
22
+ end
23
+
18
24
  private
19
25
 
20
26
  attr_reader :file
data/lib/jared/pane.rb CHANGED
@@ -5,6 +5,7 @@ module JarEd
5
5
  def refresh(window)
6
6
  window.setpos(0, 0)
7
7
  draw_lines(window)
8
+ window.setpos(buffer.cursor_row, buffer.cursor_column)
8
9
  window.noutrefresh
9
10
  end
10
11
 
data/lib/jared/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module JarEd
2
- VERSION = "1.1.0"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jareditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Norman
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.8.7
111
- description: The worst text editor.
111
+ description: The jerk's text editor.
112
112
  email:
113
113
  - jared@creepywizard.com
114
114
  executables:
@@ -152,6 +152,6 @@ rubyforge_project:
152
152
  rubygems_version: 2.5.1
153
153
  signing_key:
154
154
  specification_version: 4
155
- summary: The worst text editor.
155
+ summary: The jerk's text editor.
156
156
  test_files: []
157
157
  has_rdoc: