[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #53110] Variable Editor: Copy/paste selections
From: |
Dan Sebald |
Subject: |
[Octave-bug-tracker] [bug #53110] Variable Editor: Copy/paste selections should limit to the matrix size |
Date: |
Fri, 9 Feb 2018 14:51:42 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 |
URL:
<http://savannah.gnu.org/bugs/?53110>
Summary: Variable Editor: Copy/paste selections should limit
to the matrix size
Project: GNU Octave
Submitted by: sebald
Submitted on: Fri 09 Feb 2018 07:51:40 PM UTC
Category: GUI
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
Since there have been some recently added Variable Editor bug reports, I'll
add another one. I'm working on a revamp of the Variable Editor which should
be ready for test in a day or two. I've noticed, though, that in general the
copy/paste could use some extra work. I've fixed some bugs, but just looking
at the code I can tell that some things can't be correct.
Just as an example, here is how the paste algorithm is currently coded:
for (int i = 0; i < indices.size (); i++)
view->model ()->setData (indices[i], text.toDouble ());
The problem is that what's in the "text" could be a collection of CR-delimited
entries, not just a single ASCII-encoded number. Here is what I think is a
more useful algorithm:
QStringList cells = text.split(QRegExp("\n|\r\n|\r"));
int clen = cells.size ();
for (int i = 0; i < indices.size (); i++)
model->setData (indices[i], cells.at (i % clen).toDouble ());
The way the above works is say somewhere in the table I select two cells
1
2
and "copy" (cntrl-C). I then select five cells
0
0
0
0
0
and "paste" (cntrl-V). The above turns to
1
2
1
2
1
The main point is that I can then copy a single value (e.g., "1") and paste it
into a much bigger block of cells and set the whole sub-matrix. That seems
useful.
Anyway, I'll just pick one behavior I can tells isn't good.
If one selects a whole column or whole row using the column (row) button and
does a "copy", the action will select the whole column which includes some
empty cells at the bottom. The empty cells are put the QTableView so that the
user can effectively expand the array by typing an entry in a empty cell. But
as far as copy goes, we don't want to put the empty cells into the clipboard
buffer. We aren't working with a spreadsheet that has an indefinite number of
cells, we're working with a structured matrix. For example, if my matrix is
(I will type at the command line to simulate what is done in the V.E. table)
>> t = [1 3;2 4]
t =
1 3
2 4
its range is row 1:2 and column 1:2. If I enter a value in an empty cell (say
I type "5" in cell 3,2):
>> t(3,2) = 5
t =
1 3
2 4
0 5
Very structured; range is 1:3 by 1:2. If I delete a row or column; still very
structured. In other words, we know that our column (or row) is always going
to start at range 1 and end at one before the first empty cell. There's no
reason to copy arbitrary empty cells into a buffer along with the valid data.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?53110>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #53110] Variable Editor: Copy/paste selections should limit to the matrix size,
Dan Sebald <=