rumai 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/rumai/inochi.rb CHANGED
@@ -18,7 +18,7 @@ module Rumai
18
18
  ##
19
19
  # Number of this release of this project.
20
20
  #
21
- VERSION = '4.1.0'
21
+ VERSION = '4.1.1'
22
22
 
23
23
  ##
24
24
  # Date of this release of this project.
data/lib/rumai/wm.rb CHANGED
@@ -878,15 +878,8 @@ module Rumai
878
878
  #
879
879
  def each_column starting_column_id = 1
880
880
  i = starting_column_id
881
- loop do
882
- a = Area.new i, self
883
-
884
- if a.exist?
885
- yield a
886
- else
887
- break
888
- end
889
-
881
+ while (column = Area.new(i, self)).exist?
882
+ yield column
890
883
  i += 1
891
884
  end
892
885
  end
@@ -916,8 +909,8 @@ module Rumai
916
909
  # its peak on the left side of the screen.
917
910
  #
918
911
  def tile_rightward
919
- width, summit = calculate_right_triangle
920
- heights = (1 .. width).to_a.push(summit)
912
+ num_rising_columns, num_summit_clients = calculate_right_triangle
913
+ heights = (1..num_rising_columns).to_a.push(num_summit_clients)
921
914
  arrange_columns heights, :default
922
915
  end
923
916
 
@@ -940,8 +933,8 @@ module Rumai
940
933
  # its peak on the right side of the screen.
941
934
  #
942
935
  def tile_leftward
943
- width, summit = calculate_right_triangle
944
- heights = (1 .. width).to_a.push(summit).reverse
936
+ num_rising_columns, num_summit_clients = calculate_right_triangle
937
+ heights = (1..num_rising_columns).to_a.push(num_summit_clients).reverse
945
938
  arrange_columns heights, :default
946
939
  end
947
940
 
@@ -954,7 +947,23 @@ module Rumai
954
947
  # sides of the screen and their peaks meeting in the middle of the screen.
955
948
  #
956
949
  def tile_inward
957
- arrange_columns calculate_equilateral_triangle.flatten, :default
950
+ rising, num_summit_clients, falling = calculate_equilateral_triangle
951
+
952
+ # distribute extra clients in the middle
953
+ summit =
954
+ if num_summit_clients <= rising.length
955
+ # try to minimize the number of columns created in the middle by
956
+ # putting all summit clients in a single column--if they can fit
957
+ [num_summit_clients]
958
+ else
959
+ # no choice but to divide the summit clients into multiple columns
960
+ split = num_summit_clients / 2
961
+ carry = num_summit_clients % 2
962
+ [split, carry, split]
963
+ end.
964
+ reject(&:zero?)
965
+
966
+ arrange_columns rising + summit + falling, :default
958
967
  end
959
968
 
960
969
  ##
@@ -967,14 +976,14 @@ module Rumai
967
976
  # sides of the screen.
968
977
  #
969
978
  def tile_outward
970
- rising, summit, falling = calculate_equilateral_triangle
971
- heights = falling[0..-2].concat(rising)
979
+ rising, num_summit_clients, falling = calculate_equilateral_triangle
980
+ heights = falling + rising[1..-1]
972
981
 
973
982
  # distribute extra clients on the outsides
974
- extra = summit[0].to_i + falling[-1].to_i
975
- if extra > 0
976
- split = extra / 2
977
- carry = extra % 2
983
+ num_summit_clients += rising[0].to_i
984
+ if num_summit_clients > 0
985
+ split = num_summit_clients / 2
986
+ carry = num_summit_clients % 2
978
987
  # put the remainder on the left side to minimize the need for
979
988
  # rearrangement when clients are removed or added to the view
980
989
  heights.unshift split + carry
@@ -1029,8 +1038,8 @@ module Rumai
1029
1038
  # the given layout is applied to all columns, if specified.
1030
1039
  #
1031
1040
  def arrange_columns lengths, layout = nil
1032
- i = 0
1033
1041
  maintain_focus do
1042
+ i = 0
1034
1043
  each_column do |column|
1035
1044
  if i < lengths.length
1036
1045
  column.length = lengths[i]
@@ -1050,13 +1059,15 @@ module Rumai
1050
1059
  return [] unless num_clients > 1
1051
1060
 
1052
1061
  # calculate the dimensions of the rising sub-triangle
1053
- num_rising_columns, num_summit_clients =
1062
+ num_rising_columns, num_rising_summit_clients =
1054
1063
  calculate_right_triangle(num_clients / 2)
1055
1064
 
1065
+ num_summit_clients =
1066
+ (num_rising_summit_clients * 2) + (num_clients % 2)
1067
+
1056
1068
  # quantify entire triangle as a sequence of heights
1057
- heights = (1 .. num_rising_columns).to_a
1058
- summit = num_summit_clients > 0 ? [num_summit_clients] : []
1059
- [heights, summit, heights.reverse]
1069
+ rising = (1 .. num_rising_columns).to_a
1070
+ [rising, num_summit_clients, rising.reverse]
1060
1071
  end
1061
1072
 
1062
1073
  def calculate_right_triangle num_rising_clients = num_managed_clients
data/man/man1/rumai.1 CHANGED
@@ -4,10 +4,10 @@
4
4
  .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
5
5
  .\" Date: 2011-03-28
6
6
  .\" Manual: \ \&
7
- .\" Source: \ \& 4.1.0
7
+ .\" Source: \ \& 4.1.1
8
8
  .\" Language: English
9
9
  .\"
10
- .TH "RUMAI" "1" "2011\-03\-28" "\ \& 4\&.1\&.0" "\ \&"
10
+ .TH "RUMAI" "1" "2011\-03\-28" "\ \& 4\&.1\&.1" "\ \&"
11
11
  .\" -----------------------------------------------------------------
12
12
  .\" * Define some portability stuff
13
13
  .\" -----------------------------------------------------------------
@@ -856,6 +856,9 @@ Its exit status will indicate whether all tests have passed\&. It may also print
856
856
  .sp
857
857
  \m[blue]\fBFork this project on GitHub\fR\m[] and send a pull request\&.
858
858
  .SH "HISTORY"
859
+ .SS "Version 4\&.1\&.1 (2011\-03\-28)"
860
+ .sp
861
+ This release fixes bugs in the inward & outward automated client arrangements\&.
859
862
  .SS "Version 4\&.1\&.0 (2011\-03\-28)"
860
863
  .sp
861
864
  This release adds new automated client arrangements and cleans up the code\&.
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rumai
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 4.1.0
5
+ version: 4.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Suraj N. Kurapati